import { userMobile } from '@/utils/index'
import {
  Delete,
  CaretRight,
  Share,
  Edit,
  View,
  StarFilled
} from '@element-plus/icons-vue'

export const DEFAULT_PRIMARY = '#409eff'

// 时长配置
export const TIME_COLUMNS = [
  { text: '5分钟', value: 5 },
  { text: '10分钟', value: 10 },
  { text: '15分钟', value: 15 },
  { text: '30分钟', value: 30 },
  { text: '45分钟', value: 45 },
  { text: '1小时', value: 60 },
  { text: '1.5小时', value: 90 },
  { text: '2小时', value: 120 },
  { text: '2.5小时', value: 150 },
  { text: '3小时', value: 180 }
]

export const TIME_COLOBJ = (() => {
  const obj = {}
  TIME_COLUMNS.forEach(({ value, text }) => {
    obj[`${value}`] = text
  })
  return obj
})()

// 直播状态
export const LIVE_STATE = {
  0: '未开始',
  1: '直播中',
  2: '暂停',
  3: '已结束'
}

// 主页btns
export const INDEX_BTNS = [
  {
    name: 'live',
    title: '直播',
    icon: 'sdlive icon-shipin'
  },
  {
    name: 'video',
    title: '点播',
    icon: 'sdlive icon-zhibohuikan'
  }
]

export const INDEX_ALL_TYPES = [
  {
    name: 'live_all',
    title: '直播列表',
    type: '3',
    video_type: 'live',
    icon: 'icon-live'
  },
  {
    name: 'live_my',
    title: '我的直播',
    type: '1',
    video_type: 'live',
    icon: 'icon-wode'
  },
  {
    name: 'live_collect',
    title: userMobile() ? '我的收藏' : '直播收藏',
    type: '2',
    video_type: 'live',
    icon: 'icon-shoucangku'
  },
  {
    name: 'video_all',
    title: '点播列表',
    type: '1',
    video_type: 'video',
    icon: 'icon-zhibohuikan'
  },
  {
    name: 'video_collect',
    title: userMobile() ? '我的收藏' : '点播收藏',
    type: '2',
    video_type: 'video',
    icon: 'icon-sc-active'
  }
]

// 主页直播tabs
export const INDEX_TABS = {
  live: INDEX_ALL_TYPES.filter((item) => item.video_type === 'live'),
  video: INDEX_ALL_TYPES.filter((item) => item.video_type === 'video')
}

export const LIVE_DEFAULT_BTNS_PC = [
  {
    name: 'view-live',
    icon: View,
    btnType: 'primary',
    title: '观看直播',
    handler: 'viewLive'
  },
  {
    name: 'share-live',
    icon: Share,
    title: '分享',
    handler: 'share'
  }
]

export const LIVE_SC_BTNS_PC = [
  LIVE_DEFAULT_BTNS_PC[0],
  {
    name: 'view-video',
    icon: StarFilled,
    plain: true,
    btnType: 'primary',
    title: '取消收藏',
    handler: 'delItem'
  },
  LIVE_DEFAULT_BTNS_PC[1]
]

export const LIVE_MY_BTNS_PC = [
  {
    name: 'start-live',
    icon: CaretRight,
    btnType: 'primary',
    title: '开始直播',
    handler: 'startLive'
  },
  {
    name: 'del-live',
    icon: Delete,
    btnType: 'danger',
    title: '删除',
    handler: 'delItem'
  },
  {
    name: 'share-video',
    icon: Share,
    title: '分享',
    handler: 'share'
  }
]

export const VIDEO_DEFAULT_BTNS_PC = [
  {
    name: 'view-video',
    icon: View,
    btnType: 'primary',
    title: '观看点播',
    handler: 'viewVideo'
  },
  {
    name: 'share-video',
    icon: Share,
    title: '分享',
    handler: 'share'
  }
]

export const VIDEO_SC_BTNS_PC = [
  VIDEO_DEFAULT_BTNS_PC[0],
  {
    name: 'view-video',
    icon: StarFilled,
    plain: true,
    btnType: 'primary',
    title: '取消收藏',
    handler: 'delItem'
  },
  VIDEO_DEFAULT_BTNS_PC[1]
]
